import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '用户ID',
    align: 'center',
    dataIndex: 'id',
    width: 180,
    resizable: true,
  },
  //  {
  //   title: '会员信息',
  //   align: 'center',
  //   dataIndex: 'nickName',
  //   resizable: true,
  // },
  {
    title: '头像',
    align: 'center',
    dataIndex: 'avatar',
    customRender: render.renderImage,
    width: 120,
    resizable: true,
  },
  {
    title: '基础信息',
    align: 'center',
    dataIndex: '',
    slots: { customRender: 'userInfo1' },
    width: 200,
    resizable: true,
  },

  {
    title: '钱包余额',
    align: 'center',
    dataIndex: '',
    slots: { customRender: 'amount' },
    width: 120,
    resizable: true,
  },
  {
    title: '上级',
    align: 'center',
    dataIndex: 'parentId_dictText',
    resizable: true,
    width: 120,
  },
  {
    title: '下级数量',
    align: 'center',
    dataIndex: 'subordinateNum',
    resizable: true,
    width: 120,
  },

  //  {
  //   title: '邀请码',
  //   align:"center",
  //   dataIndex: 'inviteCode'
  //  },
  {
    title: '学生认证状态',
    align: 'center',
    dataIndex: 'isStudent_dictText',
    // slots: { customRender: 'ChangeStudent' },
    resizable: true,
    width: 120,
  },
  {
    title: '学生认证信息',
    align: 'center',
    dataIndex: 'isStudent_dictText',
    resizable: true,
    slots: { customRender: 'student' },
    width: 240,
  },
  {
    title: '用户类型',
    align: 'center',
    dataIndex: 'identity_dictText',
    resizable: true,
    width: 120,
  },
  {
    title: '注册时间',
    align: 'center',
    dataIndex: 'createTime',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '会员ID/手机号',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '微信昵称',
    field: 'nickName',
    component: 'Input',
  },
  {
    label: '学生认证状态',
    field: 'isStudent',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'student_state',
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '真实姓名',
    field: 'realName',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '身份证号',
    field: 'idCard',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '学生证照片',
    field: 'studentImage',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 1,
    },
    dynamicDisabled: true,
  },
  {
    label: '学号',
    field: 'studentNumber',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '学生认证状态',
    field: 'isStudent',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'student_state',
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  phone: { title: '手机号', order: 0, view: 'text', type: 'string' },
  nickName: { title: '昵称', order: 1, view: 'text', type: 'string' },
  avatar: { title: '头像', order: 2, view: 'image', type: 'string' },
  amount: { title: '余额', order: 3, view: 'number', type: 'number' },
  inviteCode: { title: '邀请码', order: 4, view: 'text', type: 'string' },
  isStudent: { title: '学生认证状态', order: 7, view: 'number', type: 'number', dictCode: 'student_state' },
  inviteTime: { title: '绑定上级时间', order: 10, view: 'datetime', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
